Skip to content

fix/hydrogen-preview-session-docs #64

Open
codingChewie wants to merge 1 commit into
sanity-io:mainfrom
codingChewie:fix/hydrogen-preview-session-docs
Open

fix/hydrogen-preview-session-docs #64
codingChewie wants to merge 1 commit into
sanity-io:mainfrom
codingChewie:fix/hydrogen-preview-session-docs

Conversation

@codingChewie

Copy link
Copy Markdown
Contributor

Description

  • Fix the Hydrogen Context Setup example in skills/sanity-best-practices/references/hydrogen.md by initializing a single previewSession before it is used.
  • Reuse that same previewSession in both isPreviewEnabled(...) and preview.session so the example is internally consistent.
  • Fix the loader example in the same file to use the destructured sanity variable directly when calling query(...), while still passing params and returning initial.

What to review

  • Review skills/sanity-best-practices/references/hydrogen.md only.
  • In the Context Setup example, confirm previewSession is initialized once before createSanityContext(...) and reused for both the stega.enabled check and preview.session.
  • In the loader example, confirm the destructured sanity binding now matches the sanity.query(PRODUCT_QUERY, params) call and the example still returns {initial}.

Testing

  • No automated tests were added because this PR only updates documentation examples.
  • Validated manually by reviewing the updated snippets against the current code in hydrogen.md to confirm both findings were still valid, the fixes are minimal, and the examples remain internally consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant